home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1833
/
1833.xpi
/
chrome
/
yoono.jar
/
content
/
yoono
/
aboutYoonoHelp.xul
< prev
next >
Wrap
Extensible Markup Language
|
2009-12-16
|
5KB
|
157 lines
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "init();"
>
<script>
<![CDATA[
const CI = Components.interfaces;
const CL = Components.classes;
Components.utils.import("resource://yoono/yoonoService.js");
Components.utils.import("resource://yoono/yoonoDialogs.js");
Components.utils.import("resource://yoono/yoonoPrefs.js");
Components.utils.import("resource://yoono/yoonoLog.js");
var logPath;
function init() {
updateDisplay();
}
function updateDisplay() {
var textNode;
var debugEnabledMessage = "Disabled";
if(YOONO_PREFS.get("debug.write")) {
debugEnabledMessage = "Enabled";
}
var labelDebug = document.getElementById('debugWrite');
if(labelDebug.firstChild != null){
labelDebug.firstChild.data = debugEnabledMessage;
} else {
textNode = document.createTextNode(debugEnabledMessage);
labelDebug.appendChild(textNode);
}
labelDebug.setAttribute('style', '-moz-user-select:text;-moz-user-focus:normal');
var debugLevelMessage = YOONO_PREFS.get("debug.level");
var labelDebugLevel = document.getElementById('debugLevel');
if(labelDebugLevel.firstChild != null){
labelDebugLevel.firstChild.data = debugLevelMessage;
} else {
textNode = document.createTextNode(debugLevelMessage);
labelDebugLevel.appendChild(textNode);
}
labelDebugLevel.setAttribute('style', '-moz-user-select:text;-moz-user-focus:normal');
}
function startHelpProcess() {
YOONO_PREFS.set("debug.level", 5, YOONO_PREFS.getPrefType("debug.level"));
YOONO_PREFS.set("debug.write", true, YOONO_PREFS.getPrefType("debug.write"));
YOONO_PREFS.set("debug.net", true, YOONO_PREFS.getPrefType("debug.net"));
YOONO_PREFS.set("debug.db", true, YOONO_PREFS.getPrefType("debug.db"));
document.getElementById('startButton').setAttribute('hidden', 'true');
document.getElementById('finishButton').setAttribute('hidden', 'false');
updateDisplay();
}
function finishHelpProcess() {
YOONO_PREFS.set("debug.level", 2, YOONO_PREFS.getPrefType("debug.level"));
YOONO_PREFS.set("debug.write", false, YOONO_PREFS.getPrefType("debug.write"));
YOONO_PREFS.set("debug.net", false, YOONO_PREFS.getPrefType("debug.net"));
YOONO_PREFS.set("debug.db", false, YOONO_PREFS.getPrefType("debug.db"));
//document.getElementById('startButton').setAttribute('hidden', 'false');
document.getElementById('finishButton').setAttribute('hidden', 'true');
document.getElementById('contactForm').setAttribute('hidden', 'false');
var logText = readLogFile();
var logTextBox = document.getElementById('logFile');
//var textNode = document.createTextNode(logText);
logTextBox.value = logText;
updateDisplay();
}
function submitInfo() {
document.getElementById('contactForm').setAttribute('hidden', 'true');
document.getElementById('startButton').setAttribute('hidden', 'false');
}
function readLogFile() {
try{
var istream = CL["@mozilla.org/network/file-input-stream;1"].createInstance(CI.nsIFileInputStream);
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get('ProfDS', Components.interfaces.nsIFile);
var log = file.clone();
log.append('yoono');
log.append('yoono.log');
istream.init(log, 0x01, 0444, 0);
var converter = CL["@mozilla.org/intl/converter-input-stream;1"].createInstance( CI.nsIConverterInputStream);
converter.init(istream, 'UTF-8', 1024, '-');
var line = {};
var content="";
while(converter.readString(4096, line)) {
content+=line.value+"\n";
}
istream.close();
}catch(e){};
return content;
}
]]>
</script>
<spacer height="20px"/>
<hbox>
<label value="Debug writing is:"/>
<label id="debugWrite" />
</hbox>
<spacer height="20px"/>
<hbox>
<label value="Debuging level is:"/>
<label id="debugLevel" />
</hbox>
<vbox id="startButton" align="center">
<spacer height="20px"/>
<hbox align="center">
<button label="Start Help Process" oncommand="startHelpProcess()"/>
</hbox>
</vbox>
<vbox id="finishButton" hidden="true" align="center">
<spacer height="20px"/>
<label value="Please wait for the error to occur, then press the button below to finish the help process"/>
<hbox align="center">
<button label="Finish Help Process" oncommand="finishHelpProcess()"/>
</hbox>
</vbox>
<vbox id="contactForm" hidden="true" align="center" flex="1" style="overflow: auto">
<spacer height="20px"/>
<hbox align="center" pack="end" width="600px">
<label value="Name:"/>
<textbox width="400px"/>
</hbox>
<spacer height="20px"/>
<hbox align="center" pack="end" width="600px">
<label value="Email:"/>
<textbox width="400px"/>
</hbox>
<spacer height="20px"/>
<hbox align="center" pack="end" width="600px">
<label value="Description:"/>
<textbox width="400px" multiline="true" height="150px"/>
</hbox>
<spacer height="20px"/>
<hbox align="center" pack="end" width="600px">
<label value="Log file:"/>
<textbox id="logFile" height="400px" width="400px" multiline="true"/>
</hbox>
<hbox align="center" pack="end" width="600px">
<button label="Submit" onclick="submitInfo()"/>
</hbox>
</vbox>
</window>